import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

def step_ratio(x0):

    n = len(x0)
    ratio = [x0[i]/x0[i+1] for i in range(len(x0)-1)]
    print(f"级比：{ratio}")
    min_la, max_la = min(ratio), max(ratio)
    thred_la = [np.exp(-2/(n+2)), np.exp(2/(n+2))]
    if min_la < thred_la[0] or max_la > thred_la[-1]:
        print("级比超过灰色模型的范围")
    else:
        print("级比满足要求，可用GM(1,1)模型")
    return ratio, thred_la
